/////////////////////////////////////////////////////////////////////////////
// Name:        wxauieditpanel.cpp
// Purpose:     
// Author:      Stephen Whittle
// Modified by: 
// Created:     24/09/2009 14:12:42
// RCS-ID:      
// Copyright:   
// Licence:     
/////////////////////////////////////////////////////////////////////////////

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

////@begin includes
#include "wx/imaglist.h"
#include "wxmudtextctrl.h"
#include "wxmudcommandline.h"
////@end includes

#include "wxauieditpanel.h"
#include "globals.h"

////@begin XPM images
#include "filenew.xpm"
#include "fileopen.xpm"
#include "filesave.xpm"
#include "findf.xpm"
#include "format_increaseindent.xpm"
#include "format_decreaseindent.xpm"
////@end XPM images


/*
 * wxAuiEditPanel type definition
 */

IMPLEMENT_DYNAMIC_CLASS( wxAuiEditPanel, wxPanel )


/*
 * wxAuiEditPanel event table definition
 */

BEGIN_EVENT_TABLE( wxAuiEditPanel, wxPanel )

////@begin wxAuiEditPanel event table entries
////@end wxAuiEditPanel event table entries

END_EVENT_TABLE()


/*
 * wxAuiEditPanel constructors
 */

wxAuiEditPanel::wxAuiEditPanel()
{
    Init();
}

wxAuiEditPanel::wxAuiEditPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
{
    Init();
    Create(parent, id, pos, size, style);
}


/*
 * wxAuiEditPanel creator
 */

bool wxAuiEditPanel::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
{
////@begin wxAuiEditPanel creation
    wxPanel::Create(parent, id, pos, size, style);
    CreateControls();
////@end wxAuiEditPanel creation
    return true;
}


/*
 * wxAuiEditPanel destructor
 */

wxAuiEditPanel::~wxAuiEditPanel()
{
////@begin wxAuiEditPanel destruction
    GetAuiManager().UnInit();
////@end wxAuiEditPanel destruction
}


/*
 * Member initialisation
 */

void wxAuiEditPanel::Init()
{
////@begin wxAuiEditPanel member initialisation
////@end wxAuiEditPanel member initialisation
}


/*
 * Control creation for wxAuiEditPanel
 */

void wxAuiEditPanel::CreateControls()
{    
////@begin wxAuiEditPanel content construction
    wxAuiEditPanel* itemPanel1 = this;

    GetAuiManager().SetManagedWindow(this);

    wxAuiToolBar* itemAuiToolBar2 = new wxAuiToolBar( itemPanel1, ID_AUITOOLBAR, wxDefaultPosition, wxDefaultSize, 0 );
    itemAuiToolBar2->SetToolBitmapSize(wxSize(16, 16));
    wxBitmap itemtool3Bitmap(itemPanel1->GetBitmapResource(wxT("filenew.xpm")));
    wxBitmap itemtool3BitmapDisabled;
    itemAuiToolBar2->AddTool(ID_TOOL9, _("New"), itemtool3Bitmap, itemtool3BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool4Bitmap(itemPanel1->GetBitmapResource(wxT("fileopen.xpm")));
    wxBitmap itemtool4BitmapDisabled;
    itemAuiToolBar2->AddTool(ID_TOOL10, _("Open"), itemtool4Bitmap, itemtool4BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool5Bitmap(itemPanel1->GetBitmapResource(wxT("filesave.xpm")));
    wxBitmap itemtool5BitmapDisabled;
    itemAuiToolBar2->AddTool(ID_TOOL11, _("Save"), itemtool5Bitmap, itemtool5BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool6Bitmap(itemPanel1->GetBitmapResource(wxT("findf.xpm")));
    wxBitmap itemtool6BitmapDisabled;
    itemAuiToolBar2->AddTool(Find_Replace, wxEmptyString, itemtool6Bitmap, itemtool6BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool7Bitmap(itemPanel1->GetBitmapResource(wxT("format_increaseindent.xpm")));
    wxBitmap itemtool7BitmapDisabled;
    itemAuiToolBar2->AddTool(ID_TOOL13, _("Increase Indent"), itemtool7Bitmap, itemtool7BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool8Bitmap(itemPanel1->GetBitmapResource(wxT("format_decreaseindent.xpm")));
    wxBitmap itemtool8BitmapDisabled;
    itemAuiToolBar2->AddTool(ID_TOOL14, _("Decrease Indent"), itemtool8Bitmap, itemtool8BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool9Bitmap(wxNullBitmap);
    wxBitmap itemtool9BitmapDisabled;
    itemAuiToolBar2->AddTool(ID_TOOL15, wxEmptyString, itemtool9Bitmap, itemtool9BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    itemAuiToolBar2->Realize();
    itemPanel1->GetAuiManager().AddPane(itemAuiToolBar2, wxAuiPaneInfo()
        .ToolbarPane().Name(_T("Pane1")).Top().Layer(10).LeftDockable(false).RightDockable(false).BottomDockable(false).CaptionVisible(false).CloseButton(false).DestroyOnClose(false).Resizable(false));

    wxAuiNotebook* itemAuiNotebook10 = new wxAuiNotebook( itemPanel1, ID_AUINOTEBOOK2, wxDefaultPosition, wxDefaultSize, wxAUI_NB_DEFAULT_STYLE|wxAUI_NB_TOP );

    wxTextCtrl* itemTextCtrl11 = new wxTextCtrl( itemAuiNotebook10, ID_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );

    itemAuiNotebook10->AddPage(itemTextCtrl11, _("New Document"), false);

    itemPanel1->GetAuiManager().AddPane(itemAuiNotebook10, wxAuiPaneInfo()
        .Name(_T("Pane2")).Centre().MinSize(wxSize(400, 400)).CaptionVisible(false).CloseButton(false).DestroyOnClose(false).Resizable(true).Floatable(false));

    wxMudTextCtrl* itemTextCtrl12 = new wxMudTextCtrl( itemPanel1, ID_TEXTCTRL12, wxEmptyString, wxDefaultPosition, wxSize(-1, 150), wxTE_MULTILINE );
    itemPanel1->GetAuiManager().AddPane(itemTextCtrl12, wxAuiPaneInfo()
        .Name(_T("Pane3")).Bottom().MinSize(wxSize(-1, 150)).Row(1).CaptionVisible(false).CloseButton(false).DestroyOnClose(false).Resizable(true).Floatable(false));

    wxMudCommandLine* itemTextCtrl13 = new wxMudCommandLine( itemPanel1, ID_CMDBARFTPCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
    itemPanel1->GetAuiManager().AddPane(itemTextCtrl13, wxAuiPaneInfo()
        .Name(_T("Pane4")).Bottom().MinSize(wxSize(750, -1)).LeftDockable(false).RightDockable(false).TopDockable(false).CaptionVisible(false).CloseButton(false).DestroyOnClose(false).Resizable(false).Floatable(false));

    wxTreeCtrl* itemTreeCtrl14 = new wxTreeCtrl( itemPanel1, ID_TREECTRL, wxDefaultPosition, wxSize(100, 100), wxTR_SINGLE );
    itemPanel1->GetAuiManager().AddPane(itemTreeCtrl14, wxAuiPaneInfo()
        .Name(_T("Pane5")).Right().MinSize(wxSize(150, -1)).CaptionVisible(false).CloseButton(false).DestroyOnClose(false).Resizable(true).Floatable(false));

    wxAuiToolBar* itemAuiToolBar15 = new wxAuiToolBar( itemPanel1, ID_AUITOOLBAR1, wxDefaultPosition, wxDefaultSize, wxAUI_TB_VERTICAL|wxAUI_TB_GRIPPER );
    itemAuiToolBar15->SetToolBitmapSize(wxSize(16, 16));
    wxBitmap itemtool16Bitmap(wxNullBitmap);
    wxBitmap itemtool16BitmapDisabled;
    itemAuiToolBar15->AddTool(ID_TOOL17, wxEmptyString, itemtool16Bitmap, itemtool16BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool17Bitmap(wxNullBitmap);
    wxBitmap itemtool17BitmapDisabled;
    itemAuiToolBar15->AddTool(ID_TOOL18, wxEmptyString, itemtool17Bitmap, itemtool17BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool18Bitmap(wxNullBitmap);
    wxBitmap itemtool18BitmapDisabled;
    itemAuiToolBar15->AddTool(ID_TOOL19, wxEmptyString, itemtool18Bitmap, itemtool18BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool19Bitmap(wxNullBitmap);
    wxBitmap itemtool19BitmapDisabled;
    itemAuiToolBar15->AddTool(ID_TOOL20, wxEmptyString, itemtool19Bitmap, itemtool19BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool20Bitmap(wxNullBitmap);
    wxBitmap itemtool20BitmapDisabled;
    itemAuiToolBar15->AddTool(ID_TOOL21, wxEmptyString, itemtool20Bitmap, itemtool20BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool21Bitmap(wxNullBitmap);
    wxBitmap itemtool21BitmapDisabled;
    itemAuiToolBar15->AddTool(ID_TOOL22, wxEmptyString, itemtool21Bitmap, itemtool21BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool22Bitmap(wxNullBitmap);
    wxBitmap itemtool22BitmapDisabled;
    itemAuiToolBar15->AddTool(ID_TOOL23, wxEmptyString, itemtool22Bitmap, itemtool22BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    wxBitmap itemtool23Bitmap(wxNullBitmap);
    wxBitmap itemtool23BitmapDisabled;
    itemAuiToolBar15->AddTool(ID_TOOL24, wxEmptyString, itemtool23Bitmap, itemtool23BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL);
    itemAuiToolBar15->Realize();
    itemPanel1->GetAuiManager().AddPane(itemAuiToolBar15, wxAuiPaneInfo()
        .ToolbarPane().Name(_T("Pane6")).Layer(10).CaptionVisible(false).CloseButton(false).DestroyOnClose(false).Resizable(false).Gripper(true));

    GetAuiManager().Update();

////@end wxAuiEditPanel content construction
mudTextWindows.Add(itemTextCtrl12);wxFont defaultFont;
#ifdef WIN32
defaultFont.SetNativeFontInfoUserDesc(pConfig->Read(wxT("/Font/Default"),wxT("courier new 10 windows-1252")));
#else
defaultFont.SetNativeFontInfoUserDesc(pConfig->Read(wxT("/Font/Default"),wxT("Monospace 12")));
#endif

wxTextAttr defaultStyle(wxColour(pConfig->Read(wxT("/Colours/DefaultText"),wxT("rgb(255, 255, 255)"))), 
    wxColour(pConfig->Read(wxT("/Colours/DefaultBackground"),wxT("rgb(0, 0, 0)"))), defaultFont);
setDefaultFont(defaultStyle);
setBackgroundColour(wxColour(pConfig->Read(wxT("/Colours/DefaultBackground"),wxT("rgb(0, 0, 0)"))));
itemTextCtrl12->commandLineLocal = itemTextCtrl13;
}


/*
 * Should we show tooltips?
 */

bool wxAuiEditPanel::ShowToolTips()
{
    return true;
}

/*
 * Get bitmap resources
 */

wxBitmap wxAuiEditPanel::GetBitmapResource( const wxString& name )
{
    // Bitmap retrieval
////@begin wxAuiEditPanel bitmap retrieval
    wxUnusedVar(name);
    if (name == _T("filenew.xpm"))
    {
        wxBitmap bitmap(filenew_xpm);
        return bitmap;
    }
    else if (name == _T("fileopen.xpm"))
    {
        wxBitmap bitmap(fileopen_xpm);
        return bitmap;
    }
    else if (name == _T("filesave.xpm"))
    {
        wxBitmap bitmap(filesave_xpm);
        return bitmap;
    }
    else if (name == _T("findf.xpm"))
    {
        wxBitmap bitmap(findf_xpm);
        return bitmap;
    }
    else if (name == _T("format_increaseindent.xpm"))
    {
        wxBitmap bitmap(format_increaseindent_xpm);
        return bitmap;
    }
    else if (name == _T("format_decreaseindent.xpm"))
    {
        wxBitmap bitmap(format_decreaseindent_xpm);
        return bitmap;
    }
    return wxNullBitmap;
////@end wxAuiEditPanel bitmap retrieval
}

/*
 * Get icon resources
 */

wxIcon wxAuiEditPanel::GetIconResource( const wxString& name )
{
    // Icon retrieval
////@begin wxAuiEditPanel icon retrieval
    wxUnusedVar(name);
    return wxNullIcon;
////@end wxAuiEditPanel icon retrieval
}
